/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.herenit.beijing.poc.empi;

import com.herenit.beijing.dh2011.business.empi.IPatientIndexManager;
import com.herenit.beijing.dh2011.business.ets.EtsServiceRemote;
import com.herenit.beijing.poc.serverfactory.ServerFactory;
import org.openide.modules.ModuleInstall;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;

public class Installer extends ModuleInstall {

    @Override
    public void restored() {

        ServerFactory serverFactory =
                Lookup.getDefault().lookup(ServerFactory.class);
        //    System.out.println(serverFactory == null ? "serverFactory is null!" : serverFactory.getClass().getName());
        IPatientIndexManager patientIndexManager = (IPatientIndexManager) serverFactory.getServer(null, "java:global/com.herenit.dh2011_army.his_ejb_1.0/PatientIndexManager");
        EtsServiceRemote etsService = (EtsServiceRemote) serverFactory.getServer(null, "java:global/com.herenit.dh2011_army.his_ejb_1.0/EtsService");
        //   System.out.println(patientIndexManager == null ? "patientIndexManager is null!" : patientIndexManager.getClass().getName() + ((patientIndexManager instanceof IPatientIndexManager) ? " is " : " is not ") + " instance of IPatientIndexManager");
        //  System.out.println(etsService == null ? "etsService is null!" : etsService.getClass().getName() + ((etsService instanceof EtsServiceRemote) ? " is " : " is not ") + " instance of EtsServiceRemote");
        ServiceLookup.getDefault().add(patientIndexManager);
        ServiceLookup.getDefault().add(etsService);



    }
}
